package cn.flying.cloud.flow.entity;

import java.io.Serializable;
import java.time.LocalDateTime;

import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.Version;

import cn.flying.cloud.flow.bo.FwTaskHisBo;

/**
 * 流程任务流转历史表
 *
 * @author admin
 * @since 2025-09-24 22:32:55
 */
@TableName("fw_task_his")
public class FwTaskHis implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
     * 主键ID
     */
    @TableId(value = "id", type = IdType.ASSIGN_ID)
    private Long id;

    /**
     * 流程实例ID
     */
    @TableField("proc_inst_id")
    private String procInstId;

    /**
     * 流程名称
     */
    @TableField("proc_inst_name")
    private String procInstName;

    /**
     * 业务流水号
     */
    @TableField("biz_key")
    private String bizKey;

    /**
     * 发起人
     */
    @TableField("start_user_id")
    private String startUserId;

    /**
     * 任务节点ID
     */
    @TableField("task_id")
    private String taskId;

    /**
     * 任务节点key
     */
    @TableField("task_key")
    private String taskKey;

    /**
     * 任务节点名称
     */
    @TableField("task_name")
    private String taskName;

    /**
     * 审批人ID
     */
    @TableField("user_id")
    private String userId;

    /**
     * 审批人
     */
    @TableField("user_name")
    private String userName;

    /**
     * 审批结果
     */
    @TableField("result")
    private String result;

    /**
     * 操作类型
     */
    @TableField("op_type")
    private String opType;

    /**
     * 领取时间
     */
    @TableField("claim_time")
    private LocalDateTime claimTime;

    /**
     * 开始时间
     */
    @TableField("start_time")
    private LocalDateTime startTime;

    /**
     * 结束时间
     */
    @TableField("end_time")
    private LocalDateTime endTime;

    /**
     * 持续时间
     */
    @TableField("duration")
    private String duration;

    /**
     * 备注
     */
    @TableField("remark")
    private String remark;

    /**
     * 流程定义ID
     */
    @TableField("proc_def_id")
    private String procDefId;

    /**
     * 流程定义KEY
     */
    @TableField("proc_def_key")
    private String procDefKey;

    /**
     * 创建人
     */
    @TableField(value = "created_by", fill = FieldFill.INSERT)
    private String createdBy;

    /**
     * 创建时间
     */
    @TableField(value = "created_time", fill = FieldFill.INSERT)
    private LocalDateTime createdTime;

    /**
     * 更新人
     */
    @TableField(value = "updated_by", fill = FieldFill.INSERT_UPDATE)
    private String updatedBy;

    /**
     * 更新时间
     */
    @TableField(value = "updated_time", fill = FieldFill.INSERT_UPDATE)
    private LocalDateTime updatedTime;

    /**
     * 租户号
     */
    @TableField("tenant_id")
    private String tenantId;

    /**
     * 乐观锁
     */
    @TableField(value = "revision", fill = FieldFill.INSERT)
    @Version
    private Long revision;

    /**
     * 删除标识
     */
    @TableField(value = "deleted", fill = FieldFill.INSERT)
    @TableLogic
    private String deleted;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getProcInstId() {
        return procInstId;
    }

    public void setProcInstId(String procInstId) {
        this.procInstId = procInstId;
    }

    public String getProcInstName() {
        return procInstName;
    }

    public void setProcInstName(String procInstName) {
        this.procInstName = procInstName;
    }

    public String getBizKey() {
        return bizKey;
    }

    public void setBizKey(String bizKey) {
        this.bizKey = bizKey;
    }

    public String getStartUserId() {
        return startUserId;
    }

    public void setStartUserId(String startUserId) {
        this.startUserId = startUserId;
    }

    public String getTaskId() {
        return taskId;
    }

    public void setTaskId(String taskId) {
        this.taskId = taskId;
    }

    public String getTaskKey() {
        return taskKey;
    }

    public void setTaskKey(String taskKey) {
        this.taskKey = taskKey;
    }

    public String getTaskName() {
        return taskName;
    }

    public void setTaskName(String taskName) {
        this.taskName = taskName;
    }

    public String getUserId() {
        return userId;
    }

    public void setUserId(String userId) {
        this.userId = userId;
    }

    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    public String getResult() {
        return result;
    }

    public void setResult(String result) {
        this.result = result;
    }

    public String getOpType() {
        return opType;
    }

    public void setOpType(String opType) {
        this.opType = opType;
    }

    public LocalDateTime getClaimTime() {
        return claimTime;
    }

    public void setClaimTime(LocalDateTime claimTime) {
        this.claimTime = claimTime;
    }

    public LocalDateTime getStartTime() {
        return startTime;
    }

    public void setStartTime(LocalDateTime startTime) {
        this.startTime = startTime;
    }

    public LocalDateTime getEndTime() {
        return endTime;
    }

    public void setEndTime(LocalDateTime endTime) {
        this.endTime = endTime;
    }

    public String getDuration() {
        return duration;
    }

    public void setDuration(String duration) {
        this.duration = duration;
    }

    public String getRemark() {
        return remark;
    }

    public void setRemark(String remark) {
        this.remark = remark;
    }

    public String getProcDefId() {
        return procDefId;
    }

    public void setProcDefId(String procDefId) {
        this.procDefId = procDefId;
    }

    public String getProcDefKey() {
        return procDefKey;
    }

    public void setProcDefKey(String procDefKey) {
        this.procDefKey = procDefKey;
    }

    public String getCreatedBy() {
        return createdBy;
    }

    public void setCreatedBy(String createdBy) {
        this.createdBy = createdBy;
    }

    public LocalDateTime getCreatedTime() {
        return createdTime;
    }

    public void setCreatedTime(LocalDateTime createdTime) {
        this.createdTime = createdTime;
    }

    public String getUpdatedBy() {
        return updatedBy;
    }

    public void setUpdatedBy(String updatedBy) {
        this.updatedBy = updatedBy;
    }

    public LocalDateTime getUpdatedTime() {
        return updatedTime;
    }

    public void setUpdatedTime(LocalDateTime updatedTime) {
        this.updatedTime = updatedTime;
    }

    public String getTenantId() {
        return tenantId;
    }

    public void setTenantId(String tenantId) {
        this.tenantId = tenantId;
    }

    public Long getRevision() {
        return revision;
    }

    public void setRevision(Long revision) {
        this.revision = revision;
    }

    public String getDeleted() {
        return deleted;
    }

    public void setDeleted(String deleted) {
        this.deleted = deleted;
    }

    @Override
    public String toString() {
        return "FwTaskHis{" +
                "id = " + id +
                ", procInstId = " + procInstId +
                ", procInstName = " + procInstName +
                ", bizKey = " + bizKey +
                ", startUserId = " + startUserId +
                ", taskId = " + taskId +
                ", taskKey = " + taskKey +
                ", taskName = " + taskName +
                ", userId = " + userId +
                ", userName = " + userName +
                ", result = " + result +
                ", opType = " + opType +
                ", claimTime = " + claimTime +
                ", startTime = " + startTime +
                ", endTime = " + endTime +
                ", duration = " + duration +
                ", remark = " + remark +
                ", procDefId = " + procDefId +
                ", procDefKey = " + procDefKey +
                ", createdBy = " + createdBy +
                ", createdTime = " + createdTime +
                ", updatedBy = " + updatedBy +
                ", updatedTime = " + updatedTime +
                ", tenantId = " + tenantId +
                ", revision = " + revision +
                ", deleted = " + deleted +
                "}";
    }

    public FwTaskHisBo toBO() {
        FwTaskHisBo bo = new FwTaskHisBo();
        bo.setId(this.id);
        bo.setProcInstId(this.procInstId);
        bo.setProcInstName(this.procInstName);
        bo.setBizKey(this.bizKey);
        bo.setStartUserId(this.startUserId);
        bo.setTaskId(this.taskId);
        bo.setTaskKey(this.taskKey);
        bo.setTaskName(this.taskName);
        bo.setUserId(this.userId);
        bo.setUserName(this.userName);
        bo.setResult(this.result);
        bo.setOpType(this.opType);
        bo.setClaimTime(this.claimTime);
        bo.setStartTime(this.startTime);
        bo.setEndTime(this.endTime);
        bo.setDuration(this.duration);
        bo.setRemark(this.remark);
        bo.setProcDefId(this.procDefId);
        bo.setProcDefKey(this.procDefKey);
        bo.setCreatedBy(this.createdBy);
        bo.setCreatedTime(this.createdTime);
        bo.setUpdatedBy(this.updatedBy);
        bo.setUpdatedTime(this.updatedTime);
        bo.setTenantId(this.tenantId);
        bo.setRevision(this.revision);
        bo.setDeleted(this.deleted);
        return bo;
    }

    public FwTaskHis fromBO(FwTaskHisBo bo) {
        this.setId(bo.getId());
        this.setProcInstId(bo.getProcInstId());
        this.setProcInstName(bo.getProcInstName());
        this.setBizKey(bo.getBizKey());
        this.setStartUserId(bo.getStartUserId());
        this.setTaskId(bo.getTaskId());
        this.setTaskKey(bo.getTaskKey());
        this.setTaskName(bo.getTaskName());
        this.setUserId(bo.getUserId());
        this.setUserName(bo.getUserName());
        this.setResult(bo.getResult());
        this.setOpType(bo.getOpType());
        this.setClaimTime(bo.getClaimTime());
        this.setStartTime(bo.getStartTime());
        this.setEndTime(bo.getEndTime());
        this.setDuration(bo.getDuration());
        this.setRemark(bo.getRemark());
        this.setProcDefId(bo.getProcDefId());
        this.setProcDefKey(bo.getProcDefKey());
        this.setCreatedBy(bo.getCreatedBy());
        this.setCreatedTime(bo.getCreatedTime());
        this.setUpdatedBy(bo.getUpdatedBy());
        this.setUpdatedTime(bo.getUpdatedTime());
        this.setTenantId(bo.getTenantId());
        this.setRevision(bo.getRevision());
        this.setDeleted(bo.getDeleted());
        return this;
    }
}
